package com.bosssoft.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import java.math.BigDecimal;import java.util.List;
import com.bosssoft.entity.po.FibIncomeBudgetPO;import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;import org.apache.ibatis.annotations.Select;import org.apache.ibatis.annotations.Update;

/**
 * @author Li kexi
 * Created on 2021/8/24.20:17
 */
@Mapper
public interface FibIncomeBudgetMapper extends BaseMapper<FibIncomeBudgetPO> {
    int updateBatch(List<FibIncomeBudgetPO> list);

    int updateBatchSelective(List<FibIncomeBudgetPO> list);

    int batchInsert(@Param("list") List<FibIncomeBudgetPO> list);

    int insertOrUpdate(FibIncomeBudgetPO record);

    int insertOrUpdateSelective(FibIncomeBudgetPO record);

    @Update("update fib_income_budget \n" +
            "set status=#{nextStatus} \n" +
            "where dept_id=#{deptId} and `year`=#{year}")
    int changeStatus(Long deptId, Integer year, Integer nextStatus);

    @Select("select * from fib_income_budget \n" +
            "where dept_name=#{deptName} and year = #{year}")
    FibIncomeBudgetPO selectByDeptNameAndYear(String deptName, Integer year);

    @Select("select administrative_fee,punish_confiscate_fee,special_fee \n" +
            "from fib_income_budget where status=#{status} and `year    `=#{year} ")
    List<BigDecimal[]> selectByStatus(Integer status, Integer year);

    @Select("select * from fib_income_budget \n" +
            "where dept_id=#{deptId} and year = #{year}")
    FibIncomeBudgetPO selectByDeptIdAndYear(Long deptId, Integer year);
}